package com.joeyzh.iframe.db.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.joeyzh.iframe.db.entity.MenuGroupEntity;
import com.joeyzh.iframe.db.entity.MenuItemEntity;
import com.joeyzh.iframe.db.entity.UserEntity;

import com.joeyzh.iframe.db.dao.MenuGroupEntityDao;
import com.joeyzh.iframe.db.dao.MenuItemEntityDao;
import com.joeyzh.iframe.db.dao.UserEntityDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig menuGroupEntityDaoConfig;
    private final DaoConfig menuItemEntityDaoConfig;
    private final DaoConfig userEntityDaoConfig;

    private final MenuGroupEntityDao menuGroupEntityDao;
    private final MenuItemEntityDao menuItemEntityDao;
    private final UserEntityDao userEntityDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        menuGroupEntityDaoConfig = daoConfigMap.get(MenuGroupEntityDao.class).clone();
        menuGroupEntityDaoConfig.initIdentityScope(type);

        menuItemEntityDaoConfig = daoConfigMap.get(MenuItemEntityDao.class).clone();
        menuItemEntityDaoConfig.initIdentityScope(type);

        userEntityDaoConfig = daoConfigMap.get(UserEntityDao.class).clone();
        userEntityDaoConfig.initIdentityScope(type);

        menuGroupEntityDao = new MenuGroupEntityDao(menuGroupEntityDaoConfig, this);
        menuItemEntityDao = new MenuItemEntityDao(menuItemEntityDaoConfig, this);
        userEntityDao = new UserEntityDao(userEntityDaoConfig, this);

        registerDao(MenuGroupEntity.class, menuGroupEntityDao);
        registerDao(MenuItemEntity.class, menuItemEntityDao);
        registerDao(UserEntity.class, userEntityDao);
    }
    
    public void clear() {
        menuGroupEntityDaoConfig.clearIdentityScope();
        menuItemEntityDaoConfig.clearIdentityScope();
        userEntityDaoConfig.clearIdentityScope();
    }

    public MenuGroupEntityDao getMenuGroupEntityDao() {
        return menuGroupEntityDao;
    }

    public MenuItemEntityDao getMenuItemEntityDao() {
        return menuItemEntityDao;
    }

    public UserEntityDao getUserEntityDao() {
        return userEntityDao;
    }

}
